﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {  
            Console.WriteLine("请输入操作符");
            char c = char.Parse(Console.ReadLine());       
            switch (c)
            {
                case '+':
                    Add a = new Add();
                    a.DisplayResult();
                    break;
                default:
                case '-':
                    Sub s = new Sub();
                    s.DisplayResult();
                    break;
                case '*':
                    Mul m = new Mul();
                    m.DisplayResult();
                    break;
                case '/':
                    Exc e = new Exc();
                    e.DisplayResult();
                    break;



            }
        }
    }
    class Calulate
    {
        public int a;
        public int b;
        public virtual void DisplayResult()
        {   
            Console.WriteLine("请输入第一个数");
            a = int.Parse(Console.ReadLine());
             Console.WriteLine("请输入第一个数");
            b= int.Parse(Console.ReadLine());
     
        }
    }
    class Add : Calulate
        {
        public override void DisplayResult()
        {
            base.DisplayResult();
            Console.WriteLine(a + b);
        }
    }
    class Sub : Calulate
    {
        public override void DisplayResult()
        {
            base.DisplayResult();
            Console.WriteLine(a - b);
        }
    }
    class Mul : Calulate
    {
        public override void DisplayResult()
        {
            base.DisplayResult();
            Console.WriteLine(a * b);
        }
    }
    class Exc: Calulate
    {
        public override void DisplayResult()
        {
            base.DisplayResult();
            Console.WriteLine(a / b);
        }
    }

}
